<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>

<body>
    <form action="" id="loginForm" class="fh5co-form animate-box" onsubmit="return false" method="post"
        data-animate-effect="fadeInLeft">
        <h2>Sign In</h2>
        <div class="form-group">
            <label for="username" class="sr-only">Username</label>
            <input type="text" class="form-control" id="username" name="userName" placeholder="Username"
                autocomplete="off">
        </div>
        <div class="form-group">
            <label for="password" class="sr-only">Password</label>
            <input type="password" class="form-control" id="password" name="passWord" placeholder="Password"
                autocomplete="off">
        </div>
        <div class="form-group">
            <img src="http://localhost:9001/sysController/getVerifyCodeImage?5555">
            <input type="verifyCode" class="form-control" id="verifyCode" name="verifyCode" placeholder="verifyCode"
                autocomplete="off">
        </div>
        <div class="form-group">
            <label for="remember"><input type="checkbox" id="remember"> Remember Me</label>
        </div>
        <div class="form-group">
            <p>Not registered? <a href="sign-up2.html">Sign Up</a> | <a href="forgot2.html">Forgot Password?</a>
            </p>
        </div>
        <div class="form-group">
            <input type="button" onclick="login()" value="Sign In" class="btn btn-primary">
        </div>
    </form>
</body>

</html>
<script src="http://libs.baidu.com/jquery/2.0.0/jquery.min.js"></script>

<script type="text/javascript">
    function login() {
        var username = document.getElementById("username").value;
        var password = document.getElementById("password").value;
        var verifyCode = document.getElementById("verifyCode").value;
        $.ajax({
            type: "POST",
            dataType: "json",
            url: 'http://localhost:9001/sysController/login',
            contentType: "application/json",
            data:JSON.stringify({
                "account": username,
                "password": password,
                "verifyCode":verifyCode

            }),
            success: function (result) {
                console.log("data is :" + result)
                if (result.code == 200) {
                    alert("登陆成功");
                    window.location.href = "../home/home_page.html";
                }else {
                    alert(result.message)
                }
            }
        });
    }
</script>